require.config({
    baseUrl: "js",
    paths: {
        jquery: "bower_components/jquery/dist/jquery",
        knockout: "bower_components/knockout/dist/knockout",
        bootstrap: "bower_components/bootstrap/dist/js/bootstrap.bundle",
        text: "bower_components/text/text",
        eventbus: "services/event-bus",
        dataservice: "services/data-service",
        util: "services/util",
        jcloud: "bower_components/jqcloud/jqcloud.min"
    }
});

require(['knockout'], function (ko) {
    ko.components.register("nav-bar", {
        viewModel: {
            require: 'components/nav-bar/nav-bar'
        },
        template: {
            require: 'text!components/nav-bar/nav-bar-view.html'
        }
    });
    ko.components.register("home", {
        viewModel: {
            require: 'components/home/home'
        },
        template: {
            require: 'text!components/home/home-view.html'
        }
    });
    ko.components.register("search-and-history", {
        viewModel: {
            require: 'components/search-and-history/search-and-history'
        },
        template: {
            require: 'text!components/search-and-history/search-and-history-view.html'
        }
    });
    ko.components.register("list-questions", {
        viewModel: {
            require: 'components/list-questions/list-questions'
        },
        template: {
            require: 'text!components/list-questions/list-questions-view.html'
        }
    });
    ko.components.register("saved-questions", {
        viewModel: {
            require: 'components/saved-questions/saved-questions'
        },
        template: {
            require: 'text!components/saved-questions/saved-questions-view.html'
        }
    });
    ko.components.register("word-clouds", {
        viewModel: {
            require: 'components/word-clouds/word-clouds'
        },
        template: {
            require: 'text!components/word-clouds/word-clouds-view.html'
        }
    });
    ko.components.register("login", {
        viewModel: {
            require: 'components/login/login'
        },
        template: {
            require: 'text!components/login/login-view.html'
        }
    });
    ko.components.register("registration", {
        viewModel: {
            require: 'components/registration/registration'
        },
        template: {
            require: 'text!components/registration/registration-view.html'
        }
    });
    ko.components.register("user-details", {
        viewModel: {
            require: 'components/user-details/user-details'
        },
        template: {
            require: 'text!components/user-details/user-details-view.html'
        }
    });
    ko.components.register("alert", {
        viewModel: {
            require: 'components/alert/alert'
        },
        template: {
            require: 'text!components/alert/alert-view.html'
        }
    });
    ko.components.register("pagination", {
        viewModel: {
            require: 'components/pagination/pagination'
        },
        template: {
            require: 'text!components/pagination/pagination-view.html'
        }
    });
    ko.components.register("question-details", {
        viewModel: {
            require: 'components/question-details/question-details'
        },
        template: {
            require: 'text!components/question-details/question-details-view.html'
        }
    });
});

// start application
require(['knockout', 'app'], function (ko, app) {
    ko.applyBindings(app);
});